---
apiVersion: v1
kind: Secret
metadata:
  name: htpasswd
  namespace: kube-{{ .Chart.Name }}
  {{- include "helm_lib_module_labels" (list . (dict "app" .Chart.Name)) | nindent 2 }}
data:
{{- range $location := .Values.basicAuth.internal.locations }}
  {{- if eq $location.location "/" }}
  {{ printf "htpasswd: |\n" }}
    {{- include "users" $location | b64enc | nindent 4 }}
  {{- else }}

  {{ $location.location | trimPrefix "/" | printf "%s: |\n"  }}
    {{- include "users" $location | b64enc | nindent 4 }}
  {{- end }}
{{- end }}
